#pragma once

#include "angle_estimator.h"
#include "cfar_detector.h"
#include "mti_mtd_processor.h"
#include "plot_aggregator.h"
#include "detect_structure.h"
#include <memory>

class RadarProcessor
{
public:
    RadarProcessor(const RadarParameters &params)
        : params(params)
    {
        cfar_detector = std::make_unique<CFARDetector>(2, 8, 1.5f, CA_CFAR);
        mti_mtd_processor = std::make_unique<MTI_MTDProcessor>(params);
        angle_estimator = std::make_unique<AngleEstimator>(params);
        plot_aggregator = std::make_unique<PlotAggregator>(50.0f, 5.0f, 5.0f, 3.0f);
    }

    std::vector<TargetInfo> process(const std::vector<std::vector<Pulse>> &antenna_data);

private:
    void estimateAngles(std::vector<DetectionCell> &detections,
                        const std::vector<std::vector<Pulse>> &antenna_data);

private:
    RadarParameters params;
    std::unique_ptr<CFARDetector> cfar_detector;
    std::unique_ptr<MTI_MTDProcessor> mti_mtd_processor;
    std::unique_ptr<AngleEstimator> angle_estimator;
    std::unique_ptr<PlotAggregator> plot_aggregator;
};
